package xyz.weizhi.service.Imp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xyz.weizhi.dao.accountDao;
import xyz.weizhi.service.accountService;

/**
 * @Author milian
 * @Date 2021/9/13 0013 20:27
 */
@Service
public class accountServiceImp implements accountService {
    @Autowired
    private accountDao accountDao;

    @Autowired
    private logServiceImp logServiceImp;
    @Override
    @Transactional
    public void transfer(String out, String in, Double money) {
        try {
            accountDao.reduceMoney(out,money);
            int i=1/0;
            accountDao.addMoney(in,money);
        } finally {
            logServiceImp.log(out,in,money);
        }
    }
}
